package com.zkp.d7_method_references;

public class Test3 {
    public static void main(String[] args) {
        // 1、创建这个接口的匿名内部类对象。
        /*CreatorCar cc = new CreatorCar() {
            @Override
            public Car create(String name, double price) {
                return new Car(name, price);
            }
        };*/
        //CreatorCar cc = ( name,  price) ->new Car(name, price);
        // 构造器引用
        CreatorCar cc = Car::new;
        Car c=cc.create("奔驰",999999);
        System.out.println(c);
    }
}

interface CreatorCar {
    Car create(String name, double price);
}